package com.hhss.qishi.entity.system;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.hhss.qishi.config.annotation.ChineseName;
import com.hhss.qishi.entity.common.BasePojo;

import javax.persistence.Column;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * 角色实体
 * @author hhss
 * @date 2019年3月30日 
 */
@Table(name = "sys_role")
@JsonIgnoreProperties(value = {"handler"})
public class Role extends BasePojo{
	
	private static final long serialVersionUID = 4677394723059176706L;

	/**
	 * 角色名
	 */
	@NotEmpty
	@Column(name = "role_name")
	@ChineseName("角色名")
	private String roleName;
	
	@Column(name = "role_Code")
	@ChineseName("角色代码")
	private String roleCode;
	
	/**
	 * 说明
	 */
	@Column(name = "description")
	@ChineseName("说明")
	private String description;

	/**
	 * 相关联的权限集合
	 */
	private List<Permission> permissions;
	
	/**
	 * @return the roleName
	 */
	public String getRoleName() {
		return roleName;
	}

	/**
	 * @param roleName the roleName to set
	 */
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getRoleCode() {
		return roleCode;
	}

	public void setRoleCode(String roleCode) {
		this.roleCode = roleCode;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	@ManyToMany
	public void setDescription(String description) {
		this.description = description;
	}

	public List<Permission> getPermissions() {
		return permissions;
	}

	public void setPermissions(List<Permission> permissions) {
		this.permissions = permissions;
	}

}
